package org.hibernate.test.dto;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Table(name = "USERS")
public class UserDto implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name = "IDUSER")
	@GeneratedValue(strategy=GenerationType.AUTO)
	private Long id;

	@Column(name = "NICK", nullable = false, length = 30)
	private String nick;

	@Column(name = "FIRSTNAME", nullable = false, length = 30)
	private String name;

	@Column(name = "PASSWORD", nullable = false, length = 100)
	private String password;

	@Column(name = "LASTNAME")
	private String lastName;

	@OneToOne(fetch = FetchType.LAZY, mappedBy = "user", cascade = CascadeType.ALL)
	private RolDto rol;

	public String getNick() {
		return nick;
	}

	public void setNick(String nick) {
		this.nick = nick;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	
	public RolDto getRol() {
		return rol;
	}

	public void setRol(RolDto rol) {
		this.rol = rol;
	}

	/*
	public UserDto(Long id, String nick, String name, String password, String lastName) {
		super();
		this.id = id;
		this.nick = nick;
		this.name = name;
		this.password = password;
		this.lastName = lastName;
	}
	*/
	
	
}
